#pragma once

#include <vex/core/contract/abstract_handle.h>
#include <vex/functional/contract/abstract_delegate.h>
#include <vex/functional/contract/abstract_connection.h>

namespace vex { namespace functional { namespace contract {

    // Abstraction for the ability to connect an abstract_delegate<TSignature>
    // to a multicast service but not to invoke it. The signatures of the connected 
    // types must be identical.
    template<class TSignature> 
    struct VEX_ABSTRACT abstract_multicast : virtual public core::contract::abstract_handle {
        typedef abstract_delegate<TSignature> delegate_type;
        // Connect the passed delegate to multicast service. Returns a connection object, 
        // if p_conn_req equals connection_required::yes
        virtual abstract_connection* connect(
            abstract_delegate<TSignature>* p_delegate,
            connection_required::domain p_connection_required = connection_required::no) = 0;

        VEX_PROTECT_CONTRACT(abstract_multicast);
    };
}}}